﻿namespace HRM.CORE
{
    using DevExpress.XtraEditors;
    
    using System; using Extra.ERP;
    using System.ComponentModel;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms; using Common;
    using APP.HELPER.Utils.Language;

    public class xfmTimekeeping : XtraForm
    {
        private IContainer components = null;
        private HRM.CORE.xucTimekeeping xucTimekeeping;

        public event ClosedHandler Closed;

        public event TimekeeperTableInsertedHandler TimekeeperTableInserted;

        public event UnShiftDataHandler UnShiftData;

        public xfmTimekeeping()
        {
            this.InitializeComponent();
            this.Text = MultiLanguages.GetString("tbl_Timekeeping", "TimesheetsByDate", this.Text);
            base.Load += new EventHandler(this.xfmTimekeeping_Load);
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            base.SuspendLayout();
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.ClientSize = new Size(0x23b, 0x1b3);
            base.Name = "xfmTimekeeping";
            this.Text = "Chấm C\x00f4ng Chi Tiết Theo Ng\x00e0y";
            base.ResumeLayout(false);
        }

        public void LoadTimeKeeperTable()
        {
            if (this.xucTimekeeping != null)
            {
                this.xucTimekeeping.LoadTimeKeeperTable();
            }
        }

        private void RaiseClosedHandler()
        {
            if (this.Closed != null)
            {
                this.Closed(this);
            }
        }

        private void RaiseTimekeeperTableInsertedHander()
        {
            if (this.TimekeeperTableInserted != null)
            {
                this.TimekeeperTableInserted(this);
            }
        }

        private void RaiseUnShiftDataHandler(int Month, int Year)
        {
            if (this.UnShiftData != null)
            {
                this.UnShiftData(this, Month, Year);
            }
        }

        private void xfmTimekeeping_Load(object sender, EventArgs e)
        {
            this.xucTimekeeping = new HRM.CORE.xucTimekeeping();
            this.xucTimekeeping.Dock = DockStyle.Fill;
            this.xucTimekeeping.Closed += new HRM.CORE.xucTimekeeping.ClosedHandler(this.xucTimekeeping_Closed);
            this.xucTimekeeping.UnShiftData += new HRM.CORE.xucTimekeeping.UnShiftDataHandler(this.xucTimekeeping_UnShiftData);
            this.xucTimekeeping.TimekeeperTableInserted += new HRM.CORE.xucTimekeeping.TimekeeperTableInsertedHandler(this.xucTimekeeping_TimekeeperTableInserted);
            base.Controls.Add(this.xucTimekeeping);
        }

        private void xucTimekeeping_Closed(object sender)
        {
            base.Close();
        }

        private void xucTimekeeping_TimekeeperTableInserted(object sender)
        {
            this.RaiseTimekeeperTableInsertedHander();
        }

        private void xucTimekeeping_UnShiftData(object sender, int Month, int Year)
        {
            this.RaiseUnShiftDataHandler(Month, Year);
        }

        public delegate void ClosedHandler(object sender);

        public delegate void TimekeeperTableInsertedHandler(object sender);

        public delegate void UnShiftDataHandler(object sender, int Month, int Year);
    }
}

